<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title>图灵谷-全局配置-站点配置</title>
<div th:replace="fragments/head_admin">head</div>
<link th:href="@{/resources/vendor/webuploader/webuploader.css}" rel="stylesheet" />
</head>
<body class="pace-done fixed-sidebar">
	<div id="wrapper">
		<div th:replace="fragments/menu_admin::menu(root=gconfig,current=site)">菜单栏</div>
		<div id="page-wrapper" class="gray-bg">
			<div th:replace="fragments/nav_admin">导航栏</div>
			<div th:replace="fragments/breadcrumbs_admin::breadcrumbs(parent=全局配置,current=站点配置)">面包屑栏</div>
			<div class="wrapper wrapper-content animated fadeInRight">
				<div class="row">
					<div class="col-lg-12">
						<div class="ibox float-e-margins">
							<div class="ibox-title">
								<h5>站点配置</h5>
							</div>
							<div class="ibox-content">
								<div class="row m-b-sm m-t-sm">
									<form th:action="@{/admin/m/base/site/list.gsp}" id="dataTableFilterForm" role="form" action="#" method="post">
										<div th:if="${#checkAuth.checkAuth('site_add')}" class="col-md-8">
											<a th:href="@{/admin/m/base/site/add.gsp}" data-target="#commonWin" class="btn btn-primary btn-sm" type="button" data-toggle="modal"><i class="fa fa-plus"></i>&nbsp;新增</a>
										</div>
									</form>
								</div>
								<div class="table-responsive">
									<table class="table table-striped table-hover">
										<thead>
											<tr>
												<th width="50">#</th>
												<th>状态</th>
												<th>名称</th>
												<th>代码</th>
												<th>HTML发布点</th>
												<th>模板主题</th>
												<th>域名</th>
												<th>是否识别域名</th>
												<th>是否静态首页</th>
												<th>是否默认站点</th>
												<th width="120">操作</th>
											</tr>
										</thead>
										<tbody id="dataTableDiv"></tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div th:replace="fragments/footer_admin">底部</div>
		</div>
	</div>
</body>
<div th:replace="fragments/import_js_admin">引入js</div>
<!--/* 模板引擎生成数据 */-->
<script th:inline="javascript" id="dataTableTpl" type="text/html">
/*<![CDATA[*/
{{# 
var editCheck = /*[[${#checkAuth.checkAuth('site_edit')}]]*/;
var delCheck = /*[[${#checkAuth.checkAuth('site_delete')}]]*/;
var enabledChange = /*[[${#checkAuth.checkAuth('site_enabled')}]]*/;

var editUrlPre= /*[[@{/admin/m/base/site/edit_}]]*/'url'; 
var len = d.length;
if(len>0){
	for(var i = 0, len = d.length; i < len; i++){ 
		var record=d[i];
		var num=i+1;
	}}
<tr class="gradeX">
	<td>{{num}}</td>
	<td>
		{{# if(enabledChange){ }}
			{{# if(record.enabled===1){ }}
				<input type="checkbox" data-size="mini" data-toggle="toggle" class="js-switch" data-on="启用" data-off="停用" checked="checked" onchange="myTable.changeEnabled(this, '{{record.id}}')" /> 
   	 		{{# }else{ }}
				<input type="checkbox" data-size="mini" data-toggle="toggle" class="js-switch" data-on="启用" data-off="停用" onchange="myTable.changeEnabled(this, '{{record.id}}')" />
			{{# } }}
		{{# } else { }}
			{{# if(record.enabled===1){ }}
				<span class="text-success">启用</span>
   	 		{{# }else{ }}
				<span class="text-danger">停用</span>
			{{# } }}
		{{# } }}
	</td>
	<td>{{record.siteName}}</td>
	<td class="text-success">{{record.codeNum}}</td>
	<td>{{record.htmlPublishpointName||""}}</td>
	<td>{{record.templateName||""}}</td>
	<td>{{record.domainStr||""}}</td>
	<td>
		{{# if(record.identifyDomain===1){ }}
			<span class="text-success">是</span>
   	 	{{# } }}
		{{# if(record.identifyDomain!==1){ }}
			<span class="text-danger">否</span>
		{{# } }}
	</td>
	<td>
		{{# if(record.staticHomePage===1){ }}
			<span class="text-success">是</span>
   	 	{{# } }}
		{{# if(record.staticHomePage!==1){ }}
			<span class="text-danger">否</span>
		{{# } }}
	</td>
	<td>
		{{# if(record.defaultSite===1){ }}
			<span class="text-success">是</span>
   	 	{{# } }}
		{{# if(record.defaultSite!==1){ }}
			<span class="text-danger">否</span>
		{{# } }}
	</td>
	<td>
		{{# if(editCheck){ }}
			<a href="{{editUrlPre+record.id}}.gsp" data-target="#commonWin" class="btn btn-primary btn-xs" type="button" data-toggle="modal"><i class="fa fa-edit"></i>&nbsp;修改</a>
		{{# } }}
		{{# if(delCheck){ }}
			<button class="btn btn-warning btn-xs" type="button" onclick="myTable.deleteItem('{{record.id}}')"><i class="fa fa-trash-o"></i>&nbsp;删除</button>
		{{# } }}
	</td>
</tr>
	{{# } }}
{{# }else{ }}
    <tr><td colspan="11"><br/><div class="alert alert-danger alert-dismissable">对不起，暂时没有数据可以显示，请更换查询条件重新再试！ <div></td></tr>
{{# } }}
 /*]]>*/
</script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var setting = {
        deleteUrl : /*[[@{/admin/m/base/site/delete_}]]*/'url',
        enableUrl : /*[[@{/admin/m/base/site/enable_}]]*/'url',
        disableUrl : /*[[@{/admin/m/base/site/disable_}]]*/'url',
        enabledChange : true, //修改是否可用
        dataTableTpl : 'dataTableTpl', //模板
        dataTableDiv : 'dataTableDiv', //表格
        dataTableFilterForm : 'dataTableFilterForm' //过滤表单
    };
    var myTable = new TG_Tabel.createNew(setting);
    $(function() {
        //初始化表格
        myTable.init();
    });
    /*]]>*/
</script>
<script th:src="@{/resources/vendor/webuploader/webuploader.js}"></script>
<script th:src="@{/resources/js/common/formBuilder.js}"></script>
<div th:replace="common/common_window::window(windowId=uploaderWin)">公共弹出窗口</div>
</html>